package com.san.hkhospital.controller;
import com.san.hkhospital.entity.State;
import com.san.hkhospital.service.StateService;
import com.san.hkhospital.service.impl.StateServiceImpl;
import com.san.hkhospital.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
* (state)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/state")
public class StateController {
/**
* 服务对象
*/
@Resource
private StateServiceImpl stateServiceImpl;
@Autowired
    private StateService stateService;

    /**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectOne")
public State selectOne(Integer id) {
return stateServiceImpl.selectByPrimaryKey(id);
}

    /**
     * 展示仪器状态
     * @return
     */
    @RequestMapping("stateList")
    public ResultVO apparatusStateList(){
    List<State> list = stateService.apparatusStateList();
    ResultVO success = ResultVO.success("状态查询成功",list);
    return success;
    }

    /**
     * 展示病床状态
     * @return
     */
    @RequestMapping("stateBedList")
    public ResultVO bedStateList(){
        List<State> list = stateService.bedStateList();
        System.out.println(list+"------------------------");
        ResultVO success = ResultVO.success("状态查询成功",list);
        return success;
    }

    @RequestMapping("selectState")
    public ResultVO selectState(){
        return ResultVO.success("查询成功", stateService.selectState());
    }
    @RequestMapping("jianchaList")
    public ResultVO jianchastateList(){
        List<State> jianchastateList =stateService.jianchaList();
        return  ResultVO.success("检查状态查询成功！",jianchastateList);
    }



}
